package com.cqut.ktpspring.service.impl;

import com.cqut.ktpspring.mapper.CommentMapper;
import com.cqut.ktpspring.pojo.Comment;
import com.cqut.ktpspring.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;

@Service
public class CommentServiceimpl implements CommentService {
    @Autowired
    private CommentMapper commentMapper;

    @Override
    public void comment(Comment comment) {
        comment.setCreateTime(String.valueOf(new Date()));
        commentMapper.insert(comment);
    }

    @Override
    public List<Comment> getComments(String workId) {
        return commentMapper.getComments(workId);
    }

}
